/*
 * MainForm.java
 * $Id: Degree.java 38 2007-03-25 16:27:54Z dwight $
 * this Main Form is what the user sees. it contains 3 tabbed pages.
 */

package CSIS543TFinalProject.GUI;

import java.util.List;
import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.awt.Color;

import CSIS543TFinalProject.*;
import CSIS543TFinalProject.db.*;

/**
 Main form of the Degree Planner application. This form display several 'tab'
 pages.
 @author dwight fellman
 */
public class MainForm extends javax.swing.JFrame {
   
   private Plan plan;
   private Degree degree;
   private DefaultComboBoxModel AllDegreesModel = new DefaultComboBoxModel();
   private DefaultListModel AllCoursesListModel = new DefaultListModel();
   private DefaultListModel RequiredCoursesListBoxModel = new DefaultListModel();
   private DefaultListModel SelectedCoursesListBoxModel = new DefaultListModel();
   
   private static final String APP_TITLE = "GPS Degree Planner";
   
   /** Creates new form MainForm */
   public MainForm() {
      initComponents();
      
      SetSchedPageControls();
      FillDegreesComboBox();
      OnNewDegree();
   }

   /**
    we've got a lot of spinners on the Plan page. do custom setup here with their
    custom values.
    */
   private void SetSchedPageControls() {
      SessionYearSpinner.setModel(new SpinnerListModel(new String[]{"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011"}));
      JFormattedTextField tf = ((JSpinner.DefaultEditor) SessionYearSpinner.getEditor()).getTextField();
      tf.setEditable(false);
      tf.setBackground(Color.white);

      SpringFallLoadSpinner.setModel(new SpinnerNumberModel(1, 1, 4, 1));
      tf = ((JSpinner.DefaultEditor) SpringFallLoadSpinner.getEditor()).getTextField();
      tf.setEditable(false);
      tf.setBackground(Color.white);

      summerLoadSpinner.setModel(new SpinnerNumberModel(1, 1, 2, 1));
      tf = ((JSpinner.DefaultEditor) summerLoadSpinner.getEditor()).getTextField();
      tf.setEditable(false);
      tf.setBackground(Color.white);

      String strSemester[] = new String[Semester.values().length];
      int i = 0;
      for (Semester sem : Semester.values()) {
         strSemester[i++] = sem.toString();
      }
      SessionSpinner.setModel(new SpinnerListModel(strSemester));
      tf = ((JSpinner.DefaultEditor) SessionSpinner.getEditor()).getTextField();
      tf.setEditable(false);
      tf.setBackground(Color.white);
   }
   
   /**
    load the degrees combobox, and select item zero.
    */
   private void FillDegreesComboBox() {
      DbHelper dbh = new DbHelper();
      List <Degree> degrees = dbh.GetDegreesSorted();
      dbh.close();
      for (Degree deg : degrees) {
         DegreeComboBoxDisplayItem di = new DegreeComboBoxDisplayItem(deg.getName(), deg.getConcentration());
         AllDegreesModel.addElement(di);
      }
      degreesComboBox.setModel(AllDegreesModel);
      degreesComboBox.setSelectedIndex(0);
   }
   
   /**
    on the 'Courses' panel, populate the 'Selected Courses' listbox with the
    required courses for the currently selectd Degree
    */
   private void FillSelectedCoursesWithSelectedDegree() {
      SelectedCoursesListBoxModel.removeAllElements();
      DbHelper dbh = new DbHelper();
      DegreeComboBoxDisplayItem di = (DegreeComboBoxDisplayItem) degreesComboBox.getModel().getSelectedItem();
      Degree degree = dbh.GetDegree(di.getName(), di.getConcentration());
      List <Course> courses = degree.getRequiredCourses();
      for (Course course : courses) {
         CourseListBoxDisplayItem clbdi = new CourseListBoxDisplayItem(course.getName(), course.getTitle());
         SelectedCoursesListBoxModel.addElement(clbdi);
      }
      SelectedCoursesListBox.setModel(SelectedCoursesListBoxModel);
      dbh.close();
      SetSelectedCoursesStats();
   }
   
   /**
    on the 'Courses' panel, populate the 'All Courses' listbox
    */
   private void FillAllCoursesList() {
      DbHelper dbh = new DbHelper();
      List <Course> courses = dbh.GetCoursesSorted();
      dbh.close();
      for (Course course : courses) {
         CourseListBoxDisplayItem clbdi = new CourseListBoxDisplayItem(course.getName(), course.getTitle());
         AllCoursesListModel.addElement(clbdi);
      }
      AllCoursesListBox.setModel(AllCoursesListModel);
   }
   
   /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
   // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
   private void initComponents() {
      jTabbedPane1 = new javax.swing.JTabbedPane();
      degreesPanel = new javax.swing.JPanel();
      degreesComboBox = new javax.swing.JComboBox();
      jLabel3 = new javax.swing.JLabel();
      jLabel4 = new javax.swing.JLabel();
      jLabel5 = new javax.swing.JLabel();
      minCoursesEditBox = new javax.swing.JTextField();
      minCreditsEditBox = new javax.swing.JTextField();
      jScrollPane3 = new javax.swing.JScrollPane();
      RequiredCoursesListBox = new javax.swing.JList();
      jLabel6 = new javax.swing.JLabel();
      requiredCourseCountEditBox = new javax.swing.JTextField();
      selectCoursesPanel = new javax.swing.JPanel();
      jLabel8 = new javax.swing.JLabel();
      jLabel2 = new javax.swing.JLabel();
      jLabel1 = new javax.swing.JLabel();
      selectedDegreeTextBox = new javax.swing.JTextField();
      jPanel1 = new javax.swing.JPanel();
      jScrollPane1 = new javax.swing.JScrollPane();
      AllCoursesListBox = new javax.swing.JList();
      jPanel2 = new javax.swing.JPanel();
      jScrollPane2 = new javax.swing.JScrollPane();
      SelectedCoursesListBox = new javax.swing.JList();
      RemoveCourseButton = new javax.swing.JButton();
      AddCourseButton = new javax.swing.JButton();
      viewCourseDetailButton = new javax.swing.JButton();
      jLabel9 = new javax.swing.JLabel();
      CreditsSelectedEditBox = new javax.swing.JTextField();
      CoursesSelectedCountEditBox = new javax.swing.JTextField();
      jLabel10 = new javax.swing.JLabel();
      jLabel11 = new javax.swing.JLabel();
      jLabel12 = new javax.swing.JLabel();
      CoursesNeededEditBox = new javax.swing.JTextField();
      CreditsNeededEditBox = new javax.swing.JTextField();
      CheckPreReqSelectedCoursesButton = new javax.swing.JButton();
      planPanel = new javax.swing.JPanel();
      jButton1 = new javax.swing.JButton();
      jButton2 = new javax.swing.JButton();
      jScrollPane4 = new javax.swing.JScrollPane();
      jList1 = new javax.swing.JList();
      jLabel7 = new javax.swing.JLabel();
      summerLoadSpinner = new javax.swing.JSpinner();
      jLabel13 = new javax.swing.JLabel();
      jLabel14 = new javax.swing.JLabel();
      SpringFallLoadSpinner = new javax.swing.JSpinner();
      jLabel15 = new javax.swing.JLabel();
      AutoScheduleButton = new javax.swing.JButton();
      jLabel16 = new javax.swing.JLabel();
      SessionSpinner = new javax.swing.JSpinner();
      SessionYearSpinner = new javax.swing.JSpinner();
      mainMenuBar = new javax.swing.JMenuBar();
      fileMenu = new javax.swing.JMenu();
      OpenExistingPlan = new javax.swing.JMenuItem();
      SavePlan = new javax.swing.JMenuItem();
      SavePlanAs = new javax.swing.JMenuItem();
      exitMenuItem = new javax.swing.JMenuItem();
      helpMenu = new javax.swing.JMenu();
      aboutMenuItem = new javax.swing.JMenuItem();

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
      setTitle("Degree Planner");
      degreesPanel.addComponentListener(new java.awt.event.ComponentAdapter() {
         public void componentShown(java.awt.event.ComponentEvent evt) {
            degreesPanelComponentShown(evt);
         }
      });

      degreesComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
      degreesComboBox.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            degreesComboBoxActionPerformed(evt);
         }
      });

      jLabel3.setText("Degree:");

      jLabel4.setText("Minimum number of courses:");

      jLabel5.setText("Minimum number of credits:");

      minCoursesEditBox.setEditable(false);

      minCreditsEditBox.setEditable(false);

      RequiredCoursesListBox.setModel(new javax.swing.AbstractListModel() {
         String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
         public int getSize() { return strings.length; }
         public Object getElementAt(int i) { return strings[i]; }
      });
      RequiredCoursesListBox.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
      RequiredCoursesListBox.addMouseListener(new java.awt.event.MouseAdapter() {
         public void mouseClicked(java.awt.event.MouseEvent evt) {
            RequiredCoursesListBoxMouseClicked(evt);
         }
      });

      jScrollPane3.setViewportView(RequiredCoursesListBox);

      jLabel6.setText("Required Courses:");

      requiredCourseCountEditBox.setEditable(false);

      javax.swing.GroupLayout degreesPanelLayout = new javax.swing.GroupLayout(degreesPanel);
      degreesPanel.setLayout(degreesPanelLayout);
      degreesPanelLayout.setHorizontalGroup(
         degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(degreesPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
               .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
               .addComponent(jLabel3)
               .addComponent(degreesComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, 582, Short.MAX_VALUE)
               .addGroup(degreesPanelLayout.createSequentialGroup()
                  .addGroup(degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                     .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)
                     .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING)
                     .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING))
                  .addGap(16, 16, 16)
                  .addGroup(degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                     .addComponent(requiredCourseCountEditBox)
                     .addComponent(minCreditsEditBox)
                     .addComponent(minCoursesEditBox, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE))
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 380, Short.MAX_VALUE)))
            .addContainerGap())
      );
      degreesPanelLayout.setVerticalGroup(
         degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(degreesPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addComponent(jLabel3)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(degreesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(jLabel4)
               .addComponent(minCoursesEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(jLabel5)
               .addComponent(minCreditsEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(degreesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(jLabel6)
               .addComponent(requiredCourseCountEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
            .addContainerGap())
      );
      jTabbedPane1.addTab(" Degrees ", degreesPanel);

      jLabel8.setText("Degree:");

      jLabel2.setText("All Courses:");

      jLabel1.setText("Selected Courses:");

      selectedDegreeTextBox.setEditable(false);

      AllCoursesListBox.setModel(new javax.swing.AbstractListModel() {
         String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
         public int getSize() { return strings.length; }
         public Object getElementAt(int i) { return strings[i]; }
      });
      AllCoursesListBox.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
      jScrollPane1.setViewportView(AllCoursesListBox);

      javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
      jPanel1.setLayout(jPanel1Layout);
      jPanel1Layout.setHorizontalGroup(
         jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
      );
      jPanel1Layout.setVerticalGroup(
         jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE)
      );

      SelectedCoursesListBox.setModel(new javax.swing.AbstractListModel() {
         String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
         public int getSize() { return strings.length; }
         public Object getElementAt(int i) { return strings[i]; }
      });
      SelectedCoursesListBox.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
      jScrollPane2.setViewportView(SelectedCoursesListBox);

      javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
      jPanel2.setLayout(jPanel2Layout);
      jPanel2Layout.setHorizontalGroup(
         jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE)
      );
      jPanel2Layout.setVerticalGroup(
         jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE)
      );

      RemoveCourseButton.setText("Remove Course");
      RemoveCourseButton.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            RemoveCourseButtonActionPerformed(evt);
         }
      });

      AddCourseButton.setText("Add Course");
      AddCourseButton.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            AddCourseButtonActionPerformed(evt);
         }
      });

      viewCourseDetailButton.setText("View Course Detail");
      viewCourseDetailButton.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            viewCourseDetailButtonActionPerformed(evt);
         }
      });

      jLabel9.setText("needed:");

      CreditsSelectedEditBox.setEditable(false);

      CoursesSelectedCountEditBox.setEditable(false);

      jLabel10.setText("Credits:");

      jLabel11.setText("Courses:");

      jLabel12.setText("needed:");

      CoursesNeededEditBox.setEditable(false);

      CreditsNeededEditBox.setEditable(false);

      CheckPreReqSelectedCoursesButton.setText("Check Pre-Reqs");
      CheckPreReqSelectedCoursesButton.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            CheckPreReqSelectedCoursesButtonActionPerformed(evt);
         }
      });

      javax.swing.GroupLayout selectCoursesPanelLayout = new javax.swing.GroupLayout(selectCoursesPanel);
      selectCoursesPanel.setLayout(selectCoursesPanelLayout);
      selectCoursesPanelLayout.setHorizontalGroup(
         selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(selectCoursesPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
               .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                  .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(selectedDegreeTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                     .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                           .addComponent(jLabel1)
                           .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                           .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                              .addComponent(RemoveCourseButton)
                              .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                              .addComponent(CheckPreReqSelectedCoursesButton))
                           .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                              .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, selectCoursesPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel10)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CreditsSelectedEditBox, 0, 0, Short.MAX_VALUE))
                                 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, selectCoursesPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel11)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CoursesSelectedCountEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
                              .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                              .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                 .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel12)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CoursesNeededEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                                 .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                                    .addComponent(jLabel9)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(CreditsNeededEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
                              .addGap(22, 22, 22)))))
                  .addGap(10, 10, 10))
               .addComponent(jLabel2)
               .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                  .addComponent(AddCourseButton)
                  .addContainerGap(503, Short.MAX_VALUE))
               .addGroup(selectCoursesPanelLayout.createSequentialGroup()
                  .addComponent(viewCourseDetailButton)
                  .addContainerGap())))
      );

      selectCoursesPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11});

      selectCoursesPanelLayout.setVerticalGroup(
         selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(selectCoursesPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(jLabel8)
               .addComponent(selectedDegreeTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(17, 17, 17)
            .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(jLabel2)
               .addComponent(jLabel1))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
               .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
               .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(AddCourseButton)
               .addComponent(RemoveCourseButton)
               .addComponent(CheckPreReqSelectedCoursesButton))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(viewCourseDetailButton)
               .addComponent(jLabel11)
               .addComponent(CoursesSelectedCountEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
               .addComponent(jLabel12)
               .addComponent(CoursesNeededEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addGroup(selectCoursesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
               .addComponent(jLabel10)
               .addComponent(CreditsSelectedEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
               .addComponent(jLabel9)
               .addComponent(CreditsNeededEditBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGap(27, 27, 27))
      );
      jTabbedPane1.addTab(" Courses ", selectCoursesPanel);

      jButton1.setText("Sooner");

      jButton2.setText("Later");

      jList1.setModel(new javax.swing.AbstractListModel() {
         String[] strings = { "CSIS510 Spring 2007", "CSIS543T Fall 2007", "CSIS546T Spring 2008" };
         public int getSize() { return strings.length; }
         public Object getElementAt(int i) { return strings[i]; }
      });
      jScrollPane4.setViewportView(jList1);

      jLabel7.setText("Course Schedule");

      jLabel13.setText("Course load:");

      jLabel14.setText("Spring/Fall");

      jLabel15.setText("Summer");

      AutoScheduleButton.setText("Schedule");

      jLabel16.setText("Starting:");

      javax.swing.GroupLayout planPanelLayout = new javax.swing.GroupLayout(planPanel);
      planPanel.setLayout(planPanelLayout);
      planPanelLayout.setHorizontalGroup(
         planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(planPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
               .addGroup(planPanelLayout.createSequentialGroup()
                  .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 509, Short.MAX_VALUE)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                     .addComponent(jButton1)
                     .addComponent(jButton2)))
               .addGroup(planPanelLayout.createSequentialGroup()
                  .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(planPanelLayout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                           .addComponent(jLabel15)
                           .addComponent(summerLoadSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
                     .addComponent(jLabel7))
                  .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(planPanelLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel14)
                        .addGap(26, 26, 26)
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(SessionSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(SessionYearSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 102, Short.MAX_VALUE)
                        .addComponent(AutoScheduleButton))
                     .addGroup(planPanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(SpringFallLoadSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
            .addContainerGap())
      );

      planPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButton1, jButton2});

      planPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {SpringFallLoadSpinner, summerLoadSpinner});

      planPanelLayout.setVerticalGroup(
         planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addGroup(planPanelLayout.createSequentialGroup()
            .addContainerGap()
            .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
               .addComponent(AutoScheduleButton)
               .addGroup(planPanelLayout.createSequentialGroup()
                  .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                     .addComponent(jLabel13)
                     .addComponent(jLabel15)
                     .addComponent(jLabel14)
                     .addComponent(jLabel16)
                     .addComponent(SessionSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(SessionYearSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                     .addComponent(summerLoadSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(SpringFallLoadSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
            .addGap(15, 15, 15)
            .addGroup(planPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
               .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, planPanelLayout.createSequentialGroup()
                  .addComponent(jLabel7)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE))
               .addGroup(planPanelLayout.createSequentialGroup()
                  .addGap(168, 168, 168)
                  .addComponent(jButton1)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(jButton2)))
            .addContainerGap())
      );
      jTabbedPane1.addTab(" Plan ", planPanel);

      fileMenu.setText("File");
      OpenExistingPlan.setText("Open Existing Plan...");
      OpenExistingPlan.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            OpenExistingPlanActionPerformed(evt);
         }
      });

      fileMenu.add(OpenExistingPlan);

      SavePlan.setText("Save Plan");
      SavePlan.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            SavePlanActionPerformed(evt);
         }
      });

      fileMenu.add(SavePlan);

      SavePlanAs.setText("Save Plan As...");
      SavePlanAs.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            SavePlanAsActionPerformed(evt);
         }
      });

      fileMenu.add(SavePlanAs);

      exitMenuItem.setText("Exit");
      exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitMenuItemActionPerformed(evt);
         }
      });

      fileMenu.add(exitMenuItem);

      mainMenuBar.add(fileMenu);

      helpMenu.setText("Help");
      helpMenu.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            helpMenuActionPerformed(evt);
         }
      });

      aboutMenuItem.setText("About");
      aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            aboutMenuItemActionPerformed(evt);
         }
      });

      helpMenu.add(aboutMenuItem);

      mainMenuBar.add(helpMenu);

      setJMenuBar(mainMenuBar);

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
         layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 607, Short.MAX_VALUE)
      );
      layout.setVerticalGroup(
         layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
         .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
      );
      pack();
   }// </editor-fold>//GEN-END:initComponents
   
   /**
    user wants to check the list of selected courses, to see if all the courses
    have their prerequisite course in the list. display a popup with the results.
    */
   private void CheckPreReqSelectedCoursesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CheckPreReqSelectedCoursesButtonActionPerformed
      // get all the SelectedCoursesListBox listbox items, and create a list
      // of courses. use the Course object to return a list of coursename / missing
      // prequisite messages for us to display.
      List <String> courseNames = new ArrayList <String> ();
      for (int i = 0; i < SelectedCoursesListBoxModel.size(); i++) {
         CourseListBoxDisplayItem clbdi = (CourseListBoxDisplayItem) SelectedCoursesListBoxModel.getElementAt(i);
         courseNames.add(clbdi.getName());
      }
      
      String msg = Course.getMissingPreReqsMessage(courseNames);
      JOptionPane.showMessageDialog(this, msg);
   }//GEN-LAST:event_CheckPreReqSelectedCoursesButtonActionPerformed
   
   private void SavePlanAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SavePlanAsActionPerformed
      JOptionPane.showMessageDialog(this, "todo: save current Plan; prompt for filename.");
   }//GEN-LAST:event_SavePlanAsActionPerformed
   
   private void SavePlanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SavePlanActionPerformed
      JOptionPane.showMessageDialog(this, "todo: save current Plan");
   }//GEN-LAST:event_SavePlanActionPerformed
   
   private void OpenExistingPlanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenExistingPlanActionPerformed
      JOptionPane.showMessageDialog(this, "todo: open existing Plan");
   }//GEN-LAST:event_OpenExistingPlanActionPerformed
   
   /**
    user has clicked on one of the courses. do a popup, showing the course detail.
    */
   private void viewCourseDetailButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewCourseDetailButtonActionPerformed
      CourseListBoxDisplayItem clbdi = (CourseListBoxDisplayItem) AllCoursesListBox.getSelectedValue();
      DbHelper dbh = new DbHelper();
      Course c = dbh.GetCourse(clbdi.getName());
      String s = String.format("%d credits.\n\n%s\n\nold course: %s", c.getCredits(), c.getDescription(), c.getOldName());
      
      JTextArea jta = new  JTextArea(s);
      jta.setLineWrap(true);
      jta.setWrapStyleWord(true);
      int cols = 48;
      jta.setColumns(cols);
      int docLen = jta.getDocument().getLength();
      jta.setRows((int)Math.ceil(docLen / cols));
      JOptionPane pane = new JOptionPane();
      pane.showMessageDialog(null, jta, "Course detail for " + clbdi.getName() + ": " + clbdi.title, JOptionPane.INFORMATION_MESSAGE);
      dbh.close();
   }//GEN-LAST:event_viewCourseDetailButtonActionPerformed
   
   /**
    * user clicked on one of the courses.  show detail for the course.
    */
   private void RequiredCoursesListBoxMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_RequiredCoursesListBoxMouseClicked
      CourseListBoxDisplayItem clbdi = (CourseListBoxDisplayItem) RequiredCoursesListBox.getSelectedValue();
      DbHelper dbh = new DbHelper();
      Course c = dbh.GetCourse(clbdi.getName());
      String s = String.format("%d credits.\n\n%s\n\nold course: %s", c.getCredits(), c.getDescription(), c.getOldName());
      
      JTextArea jta = new  JTextArea(s);
      jta.setLineWrap(true);
      jta.setWrapStyleWord(true);
      int cols = 48;
      jta.setColumns(cols);
      int docLen = jta.getDocument().getLength();
      jta.setRows((int)Math.ceil(docLen / cols));
      JOptionPane pane = new JOptionPane();
      pane.showMessageDialog(null, jta, "Course detail for " + clbdi.getName() + ": " + clbdi.title, JOptionPane.INFORMATION_MESSAGE);
      
      dbh.close();
   }//GEN-LAST:event_RequiredCoursesListBoxMouseClicked
   
   /**
    user has selected a new Degree item from the Degrees combobox.
    set our member Degree object to the new value, and propagate changes to
    all controls.
    */
   private void degreesComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_degreesComboBoxActionPerformed
      DbHelper dbh = new DbHelper();
      DegreeComboBoxDisplayItem di = (DegreeComboBoxDisplayItem) degreesComboBox.getModel().getSelectedItem();
      degree = dbh.GetDegree(di.getName(), di.getConcentration());
      dbh.close();
      
      OnNewDegree();
   }//GEN-LAST:event_degreesComboBoxActionPerformed
   
   /**
    called at app startup, or when user selects a new degree.
    */
   private void OnNewDegree() {
      FillAllCoursesList();
      FillRequiredCoursesListBox();
      SetControlDataForSelectedDegree();
      LoadPlanWithSelectedDegree();
      FillSelectedCoursesWithSelectedDegree();
   }
   
   /**
    when the user selects a new Degree, we create a new Plan.
    */
   void LoadPlanWithSelectedDegree() {
      DbHelper dbh = new DbHelper();
      DegreeComboBoxDisplayItem di = (DegreeComboBoxDisplayItem) degreesComboBox.getModel().getSelectedItem();
      Degree degree = dbh.GetDegree(di.getName(), di.getConcentration());
      plan = new Plan(degree);
      dbh.close();
   }
   
   /**
    for the current Degree, fill the other data items with Degree-related
    data
    */
   void SetControlDataForSelectedDegree() {
      DegreeComboBoxDisplayItem di = (DegreeComboBoxDisplayItem) degreesComboBox.getModel().getSelectedItem();
      minCoursesEditBox.setText(Integer.toString(degree.getMinCourses()));
      minCreditsEditBox.setText(Integer.toString(degree.getMinCredits()));
      selectedDegreeTextBox.setText(di.toString());
   }
   
   /**
    * for the current degree, fill the required courses listbox.
    */
   private void FillRequiredCoursesListBox() {
      RequiredCoursesListBoxModel.clear();
      List <Course> requiredCourses = degree.getRequiredCourses();
      for (Course c : requiredCourses) {
         CourseListBoxDisplayItem clbdi = new CourseListBoxDisplayItem(c.getName(), c.getTitle());
         RequiredCoursesListBoxModel.addElement(clbdi);
      }
      RequiredCoursesListBox.setModel(RequiredCoursesListBoxModel);
      requiredCourseCountEditBox.setText(Integer.toString(requiredCourses.size()));
   }
   
   private void degreesPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_degreesPanelComponentShown
      // TODO add your handling code here:
   }//GEN-LAST:event_degreesPanelComponentShown
   
   private void AddCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddCourseButtonActionPerformed
      CourseListBoxDisplayItem clbdi = (CourseListBoxDisplayItem) AllCoursesListBox.getSelectedValue();
      if (null == clbdi) {
         JOptionPane pane = new JOptionPane();
         String msg = "select a course from the All Courses listbox";
         pane.showMessageDialog(null, msg, APP_TITLE, JOptionPane.INFORMATION_MESSAGE);
         return;
      }
      
      // add the selected course to the Plan. user can check for pre-reqs later.
      if (plan.AddCourse(clbdi.getName())) {
         // we successfully added the course to the Plan. Now, update the GUI
         DbHelper dbh = new DbHelper();
         Course course = dbh.GetCourse(clbdi.getName());
         clbdi = new CourseListBoxDisplayItem(course.getName(), course.getTitle());
         SelectedCoursesListBoxModel.addElement(clbdi);
         dbh.close();
      }
      SetSelectedCoursesStats();
   }//GEN-LAST:event_AddCourseButtonActionPerformed
   
   /**
    remove the selected course from the 'selected courses' listbox. user can
    check for pre-requesites later.
    */
   private void RemoveCourseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveCourseButtonActionPerformed
      CourseListBoxDisplayItem clbdi = (CourseListBoxDisplayItem) SelectedCoursesListBox.getSelectedValue();
      JOptionPane pane = new JOptionPane();
      if (clbdi == null) {
         String msg = "select a course from the Selected Courses listbox";
         pane.showMessageDialog(null, msg, APP_TITLE, JOptionPane.INFORMATION_MESSAGE);
         return;
      }
      
      // rule: warn user if they remove a required course.
      if (degree.isCourseRequiredForDegree(clbdi.getName())) {
         //dlftest pane.showMessageDialog(null, "cannot delete a required course", APP_TITLE, JOptionPane.WARNING_MESSAGE);
         int result = pane.showConfirmDialog(null, "You are attempting to removed a course that is required for this degree. Do you *really* want to remove it?", APP_TITLE, pane.YES_NO_OPTION);
         if (JOptionPane.YES_OPTION != result)
            return;
      }
      
      SelectedCoursesListBoxModel.removeElement(clbdi);
      plan.removeCourse(clbdi.getName());
      SetSelectedCoursesStats();
   }//GEN-LAST:event_RemoveCourseButtonActionPerformed
   
   private void SetSelectedCoursesStats() {
      int courseCount = plan.getCurrentCourseCount();
      int courseCredits = plan.getCurrentCreditCount();
      CoursesNeededEditBox.setText(Integer.toString(degree.getMinCourses()));
      CreditsNeededEditBox.setText(Integer.toString(degree.getMinCredits()));
      CreditsSelectedEditBox.setText(Integer.toString(courseCredits));
      CoursesSelectedCountEditBox.setText(Integer.toString(courseCount));
   }
   
   /**
    * user want's to see the help/about
    */
   private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
      JOptionPane pane = new JOptionPane();
      String msg =
         "Dwight Fellman: dlfellman@stthomas.edu\n" +
         "Ida Nkonge: IMNKONGE@stthomas.edu\n" +
         "Isabella Anderson: iyanderson@stthomas.edu\n" +
         "Praveen Prabhakaran: pkprabhakara@stthomas.edu\n" +
         "Sheku Kamara: SKAMARA@stthomas.edu";
      pane.showMessageDialog(null, msg, "about GPS Degree Planner", JOptionPane.INFORMATION_MESSAGE);
   }//GEN-LAST:event_aboutMenuItemActionPerformed
   
   private void helpMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpMenuActionPerformed
// TODO add your handling code here:
   }//GEN-LAST:event_helpMenuActionPerformed
   
   private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
      System.exit(0);
   }//GEN-LAST:event_exitMenuItemActionPerformed
   
   /**
    * @param args the command line arguments
    */
   public static void main(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
         public void run() {
            new MainForm().setVisible(true);
         }
      });
   }
   
   // Variables declaration - do not modify//GEN-BEGIN:variables
   private javax.swing.JButton AddCourseButton;
   private javax.swing.JList AllCoursesListBox;
   private javax.swing.JButton AutoScheduleButton;
   private javax.swing.JButton CheckPreReqSelectedCoursesButton;
   private javax.swing.JTextField CoursesNeededEditBox;
   private javax.swing.JTextField CoursesSelectedCountEditBox;
   private javax.swing.JTextField CreditsNeededEditBox;
   private javax.swing.JTextField CreditsSelectedEditBox;
   private javax.swing.JMenuItem OpenExistingPlan;
   private javax.swing.JButton RemoveCourseButton;
   private javax.swing.JList RequiredCoursesListBox;
   private javax.swing.JMenuItem SavePlan;
   private javax.swing.JMenuItem SavePlanAs;
   private javax.swing.JList SelectedCoursesListBox;
   private javax.swing.JSpinner SessionSpinner;
   private javax.swing.JSpinner SessionYearSpinner;
   private javax.swing.JSpinner SpringFallLoadSpinner;
   private javax.swing.JMenuItem aboutMenuItem;
   private javax.swing.JComboBox degreesComboBox;
   private javax.swing.JPanel degreesPanel;
   private javax.swing.JMenuItem exitMenuItem;
   private javax.swing.JMenu fileMenu;
   private javax.swing.JMenu helpMenu;
   private javax.swing.JButton jButton1;
   private javax.swing.JButton jButton2;
   private javax.swing.JLabel jLabel1;
   private javax.swing.JLabel jLabel10;
   private javax.swing.JLabel jLabel11;
   private javax.swing.JLabel jLabel12;
   private javax.swing.JLabel jLabel13;
   private javax.swing.JLabel jLabel14;
   private javax.swing.JLabel jLabel15;
   private javax.swing.JLabel jLabel16;
   private javax.swing.JLabel jLabel2;
   private javax.swing.JLabel jLabel3;
   private javax.swing.JLabel jLabel4;
   private javax.swing.JLabel jLabel5;
   private javax.swing.JLabel jLabel6;
   private javax.swing.JLabel jLabel7;
   private javax.swing.JLabel jLabel8;
   private javax.swing.JLabel jLabel9;
   private javax.swing.JList jList1;
   private javax.swing.JPanel jPanel1;
   private javax.swing.JPanel jPanel2;
   private javax.swing.JScrollPane jScrollPane1;
   private javax.swing.JScrollPane jScrollPane2;
   private javax.swing.JScrollPane jScrollPane3;
   private javax.swing.JScrollPane jScrollPane4;
   private javax.swing.JTabbedPane jTabbedPane1;
   private javax.swing.JMenuBar mainMenuBar;
   private javax.swing.JTextField minCoursesEditBox;
   private javax.swing.JTextField minCreditsEditBox;
   private javax.swing.JPanel planPanel;
   private javax.swing.JTextField requiredCourseCountEditBox;
   private javax.swing.JPanel selectCoursesPanel;
   private javax.swing.JTextField selectedDegreeTextBox;
   private javax.swing.JSpinner summerLoadSpinner;
   private javax.swing.JButton viewCourseDetailButton;
   // End of variables declaration//GEN-END:variables
   
   /**
    * used only for the Degrees combobox on this page. instances of this class are
    * stored in the combobox items.
    */
   private class CourseListBoxDisplayItem {
      public CourseListBoxDisplayItem(String name, String title) {
         this.name = name;
         this.title = title;
      }
      public String toString() {
         String s = String.format("%-16s %-128s", name, title);
         return s;
      }
      
      private String name;
      private String title;
      
      public String getName() {
         return name;
      }
      
      public void setName(String name) {
         this.name = name;
      }
      
      public String getTitle() {
         return title;
      }
      
      public void setTitle(String title) {
         this.title = title;
      }
   }
   
   /**
    * used only for the Degrees combobox on this page. instances of this class are
    * stored in the combobox items.
    */
   private class DegreeComboBoxDisplayItem {
      public DegreeComboBoxDisplayItem(String name, String concentration) {
         this.setName(name);
         this.setConcentration(concentration);
      }
      private String name;
      private String concentration;
      
      public String getName() {
         return name;
      }
      
      public void setName(String name) {
         this.name = name;
      }
      
      public String getConcentration() {
         return concentration;
      }
      
      public void setConcentration(String concentration) {
         this.concentration = concentration;
      }
      /**
       * used for "what's displayed" in each combobox item.
       **/
      public String toString() {
         return name + " " + concentration;
      }
   }
   
   
   
}

